package com.leetcode.LC;

public class LC1758 {
    public int minOperations(String s) {

        int min1 = 0, min2 = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != (i % 2) + '0') {//010101010
                min1++;
            }
            if (s.charAt(i) != ((i + 1) % 2) + '0') {//10101010
                min2++;
            }
        }
        return Math.min(min1, min2);
    }

    public static void main(String[] args) {
        System.out.println(new LC1758().minOperations("0100"));
    }
}
